import request from '@/utils/httpRequest'

//后台商品类目
export function backGoodsCategory(data = {}) {
  return request({
    url: '/pop/back_cate',
    method: 'get',
    params: { ...data }
  })
}

//中台通过的商品列表
export function mpPassGoodsList(data = {}) {
  return request({
    url: '/pop/goods/mp/back_list',
    method: 'post',
    params: { ...data }
  })
}

//后台管理商品列表
export function backGoodsList(data = {}) {
  return request({
    url: '/pop/goods/back_list',
    method: 'get',
    params: { ...data }
  })
}

//导出商品sku
export function exportE3GoodsSku(data = {}) {
  return request({
    url: '/pop/goods/export_to_e3',
    method: 'post',
    responseType: 'blob',
    data: { ...data }
  })
}

//商家下拉列表
export function getShopSelectList(param) {
  return request({
    url: `/pop/goods/select_shop`,
    method: 'get',
    params: param || {}
  })
}

//根据商品id查询中台商品详情
export function mpGoodsDetailByGoodsId(data = {}) {
  return request({
    url: '/pop/goods/mp/' + data.goodsId,
    method: 'get'
  })
}

//根据商品id查询中台商品详情
export function mpGoodsDetailByProcessId(data = {}) {
  return request({
    url: '/pop/goods/mp/detail/' + data.processId,
    method: 'get'
  })
}

//编辑商品档案
export function editGoods(data = {}) {
  return request({
    url: '/pop/goods/back/edit_audit/' + data.processId,
    method: 'put',
    data: { ...data }
  })
}

//根据id商品详情
export function goodsDetailById(data = {}) {
  return request({
    url: '/pop/goods/' + data.id,
    method: 'get'
  })
}

//审核日志
export function auditRecord(param) {
  return request({
    url: '/pop/record/audit',
    method: 'get',
    params: param || {}
  })
}

export function goodsDiffRecord(param) {
  return request({
    url: '/pop/field/change/list',
    method: 'get',
    params: param || {}
  })
}